<template>
  <Portlet :title="endAddress ? '目的地信息' : '客户信息'" >
    <el-form label-position="left" label-width="120px">
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="客户姓名：">
          <span>{{ consigneName }}</span>
        </el-form-item>
      </el-col>
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="客户电话：">
          <span>{{ consignePhone }}</span>
        </el-form-item>
      </el-col>
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="客户地址：">
          <span>{{ consigneProvince }}{{ consigneCity }}{{ consigneDistrict }}{{ consigneAddress }}</span>
        </el-form-item>
      </el-col>
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="有无电梯：">
          <span>{{ isElevator === 1 ? '有' : '无' }}</span>
        </el-form-item>
      </el-col>
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="楼层：">
          <span>{{ floor }} <span v-if="floor">楼</span></span>
        </el-form-item>
      </el-col>
      <el-col :lg="8" :md="12"  :xl="6">
        <el-form-item label="预约时间：" v-if="predictServiceDateModelCode">
          <span>{{ predictServiceDate | unixTimestampFilter('YYYY-MM-DD') }} {{predictServiceDateCode}}</span>
        </el-form-item>
      </el-col>
    </el-form>
  </Portlet>
</template>
<script>
import {dotData} from '@/utils'
import {unixTimestampFilter, isTrue, filterDataBaseDictionary} from '@/filters'
export default {
  name: 'pickup',
  components: {
  },
  filters: {
    unixTimestampFilter,
    isTrue
  },
  props: {
    orderDetail: {
      type: Object,
      required: true
    },
    endAddress: {
      type: String,
      default: ''
    }
  },
  computed: {
    consigneName() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consigneName')
    },
    consignePhone() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consignePhone')
    },
    consigneProvince() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consigneProvince')
    },
    consigneCity() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consigneCity')
    },
    consigneDistrict() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consigneDistrict')
    },
    consigneAddress() {
      return dotData(this.orderDetail, 'fhbOrderConsigneeInfo.consigneAddress')
    },
    predictServiceDate() {
      return dotData(this.orderDetail, 'fhbOrder.predictServiceDate')
    },
    predictServiceDateCode() {
      return filterDataBaseDictionary(dotData(this.orderDetail, 'fhbOrder.predictServiceDateCode'))
    },
    isElevator() {
      return dotData(this.orderDetail, 'fhbOrderDeliveryInfo.isElevator')
    },
    floor() {
      return dotData(this.orderDetail, 'fhbOrderDeliveryInfo.floor')
    },
    predictServiceDateModelCode() {
      let options = dotData(this.orderDetail, 'options') || []
      let obj = options.find(item => item.modelCode === 'predictServiceDate') || {}
      return obj.modelCode
    }
  }
}
</script>
